<?php
	class function_global{
		function huruf2angka($nilai) {
			switch ($nilai) {
				case "A" : { return 4; break; }
				case "AB" :{ return 3.5; break; }
				case "B" :{ return 3; break; }
				case "BC" :{ return 2.5; break; }
				case "C" :{ return 2; break; }
				case "D" :{ return 1; break; }
				case "E" :{ return 0; break; }
				default : { return 0; break; }
			}
		}
		
	}
	
	$function = new function_global();

	//special function
	$urutan_sort_nilai_huruf = array('A','AB','B','BC','C','D','E','BL');
	
	function sort_nilai_huruf($a, $b){
	   global $urutan_sort_nilai_huruf;
	   $pos1=array_search ($a[nilai], $urutan_sort_nilai_huruf);
	   $pos2=array_search ($b[nilai], $urutan_sort_nilai_huruf);
	   if ($pos1==$pos2)
		   return 0;
	   else
		  return ($pos1 < $pos2 ? -1 : 1);
	}
?>